<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子模型</title>
</head>
<style>
    .box {
        box-sizing: content-box;
        /* 上 */
        margin-top: 1px;
        border-top: 2px solid red;
        padding-top: 3px;
        /* 下 */
        margin-bottom: 4px;
        border-bottom: 5px solid green;
        padding-bottom: 6px;
        /* 左 */
        margin-left: 7px;
        border-left: 8px solid yellow;
        padding-left: 9px;
        /* 右 */
        margin-right: 10px;
        border-right: 11px solid blue;
        padding-right: 12px;
    }
</style>

<body>
    <div class="box">
        <img src="./盒子模型.jpg">
    </div>
</body>

</html>